﻿﻿  <?php
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');
$infoid=trim($_GET['id']);
if ($infoid){
    $sql = "select * from tbl_skill_details where  status=0 AND id = '".$infoid."'";
    $query=mysql_query($sql);
    $row=mysql_fetch_array($query);
	$maijiasf = $row['uid'];
	$imgeve =explode(",", $row['pics']);
	
	
    $sqltu = "select * from tbl_tutu where userid = ".$maijiasf;
    $querytu=mysql_query($sqltu);
    $rowtu=mysql_fetch_array($querytu);  

    $sql="update tbl_skill_details set click_rate=click_rate+1 where id=".$infoid;
    mysql_query($sql);
	
}else{
    echo "<script type='text/javascript'>alert('\u6587\u7ae0\u4e0d\u5b58\u5728\uff01');history.go(-1);</script>";
    exit;
}

$maijia=$row['uid'];
$sqlm = "select * from tbl_user where id=".$maijia;
$querym=mysql_query($sqlm);
$rowm=mysql_fetch_array($querym);
$maijiaid=$rowm['id'];
$jifen = $rowm['jifen'];
$yuee = $rowm['yuee'];
$xyf = $rowm['xyf'];
$vip = $rowm['vip'];
$maijianame ='￥:'.$row['daili'].'\n 卖家:'. $rowm['shuyu'];
//查上传量
$sqla = "select count(*) as cc from tbl_skill_details where status=0 AND  uid='".$maijiasf."'";
$querya=mysql_query($sqla);
$rowa=mysql_fetch_array($querya);
$s = $rowa['cc'];

//加入购物车数量
$sqlbu = "select count(*) as ddu from tbl_gwc where userid='".$_COOKIE['userid']."'";
$querybu=mysql_query($sqlbu);
$rowbu=mysql_fetch_array($querybu);
$gwcsl= $rowbu['ddu'];  
//认证
$sqls = "select * from tbl_shiming where userid='".$maijiaid."'";
$querys=mysql_query($sqls);
$rows=mysql_fetch_array($querys);
$sm="未实名";
if($rows){
	$sm="已实名";
}

if($_GET["act"]=="sc")
{
	if(!$_COOKIE['userid']){
	echo "<script type='text/javascript'>location.href='mlogin.php';</script>";
	exit;
}

	   $maijiaa=$_GET['maijia'];
	   $sqlh = "select * from tbl_skill_collect where  article_id = '".$_GET['id']."'  AND uid = '".$_COOKIE['userid']."'  ";
    $queryh=mysql_query($sqlh);
    $rowh=mysql_fetch_array($queryh);
    if($rowh){
        echo "<script type='text/javascript'>alert('不要重复收藏!');history.go(-1);</script>";
        exit;
    }
	
		$sql = "insert into
	 tbl_skill_collect
	  values (
	  	0,
	  	'".$_COOKIE['userid']."',
		'".$infoid."',	
	    '".date('Y-m-d H:i:s')."'
		)";
	mysql_query($sql);
	 mysql_close();
	 echo "<script type='text/javascript'>alert('收藏成功');history.go(-1);</script>";
	 exit;
}

?> 
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title><?=$_COOKIE['shuyu']?><?=$shopname?>.商品详情页-众晒网</title>
    <meta name="description" content="共享资源,共享二手资源,闲置二手资源,闲置资源">
    <meta name="keywords" content="共享资源,共享二手资源,闲置二手资源,闲置资源">
    <meta name="author" content="共享资源,共享二手资源,闲置二手资源,闲置资源">		
    <link href="/ui/css/Hui.css" rel="stylesheet" type="text/css" />
	<link href="/ui/plugins/photoswipe/photoswipe.css" rel="stylesheet" />
    <link href="/ui/plugins/photoswipe/default-skin/default-skin.css" rel="stylesheet" />	
    <style type="text/css">
	
        #header{width:100%; height:44px; position:absolute; top:0;}
        #footer{width:100%; height:55px; position:absolute; bottom:0;}
        #main{width:100%; overflow: auto; position:absolute; top:44px;bottom:55px;}
        .my-gallery { width: 100%; float: left; }
        .my-gallery img { width: 100%; height: auto; }
        .my-gallery figure { display: block; float: left; margin: 0 5px 5px 0; width: 100%; }
        .my-gallery figcaption { display: none; }			
	</style>
</head>
<body class="H-theme-background-color-white">
     <!--################### 华丽的分割线 ###################-->
  <header class="H-header H-theme-background-color-white" id="header">
        <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-gray H-padding-horizontal-left-5 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-font-size-18 H-vertical-middle"></i></span>
        <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-black H-position-absolute H-width-100-percent" >技能详情</div>
    </header>  
     <!--################### 华丽的分割线 ###################-->
    <div id="main"  style="background-color:white">  
	<div class="H-padding-vertical-bottom-10"></div>
	 <!--################### 租赁显示判断 ###################-->

	         <div class="apply-list H-position-relative H-flexbox-horizontal H-box-sizing-border-box H-padding-10 H-border-vertical-bottom-after">
            <div>
                <img src="<?=$imgeve[0]?>" style="width:70px;height: 70px;display: block;" />
            </div>
            <div class="H-flex-item H-text-show-row-1 H-box-sizing-border-box H-padding-horizontal-left-10">
                <div class="H-text-show-row-2 H-font-size-15 H-font-weight-600">
                    <?=$row['title']?>
                </div>
                <div class="H-flexbox-horizontal H-max-width-100-percent H-theme-font-color-999">
                    <div class="H-flex-item H-text-show-row-1 H-font-size-14 H-padding-vertical-both-5" style="margin-top: -1px;font-size: 25px;color: #f0ad4e;">￥:<?=$row['price']?></div>
                    <div class="H-font-size-12 H-text-show-row-1 H-padding-horizontal-left-10 H-box-sizing-border-box H-padding-horizontal-both-10 H-vertical-middle">
                  
                        <label><?=$row['city']?></label>
                    </div>
                    <div class="H-vertical-middle H-font-size-12">
                        <label>浏览量:<?=$row['click_rate']?></label>
                    </div>
                </div>
            </div>
        </div>
	 
     <!--################### 华丽的分割线 ###################-->
        <div class="H-flexbox-horizontal H-theme-background-color-white H-border-vertical-bottom-after">
        <div class="H-flex-item H-padding-10">
			 <p class="H-padding-horizontal-both-10 H-font-size-16 H-theme-font-color3-active">技能详情:</p>
           <p class="H-padding-horizontal-both-10 H-font-size-16 H-theme-font-color3-active"><?=$row['details']?></p>
             
        </div>
       
    </div>
     <!--################### 华丽的分割线 ###################-->
    <div class="H-img-show H-padding-10">
        <div class="my-gallery" itemscope itemtype="http://schema.org/ImageGallery">
							<?php
			$sqlimg="SELECT * FROM tbl_skill_details WHERE id= ".$row['id'];
			$rowimg= mysql_query($sqlimg);
			$rowall=mysql_fetch_array($rowimg);
			$imgeve =explode(",", $rowall['pics']);
			// print_r($imgeve);
			// $roweve=$rowall['ywyuedu'];
			 $imglen=count($imgeve);
			foreach($imgeve as $src){
				if(strlen($src)<=0){
					continue;
				}else{
				echo "
				<figure itemprop='associatedMedia' itemscope itemtype='http://schema.org/ImageObject'>
                <a href='$src' itemprop='contentUrl' data-size='460x460'>
                    <img src='$src' itemprop='thumbnail' alt='Image description' />
                </a>
                <figcaption itemprop='caption description'>  </figcaption>
               </figure>
			";
			}
			}
		    ?>
        </div>
        <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
            <div class="pswp__bg"></div>
            <div class="pswp__scroll-wrap">
                <div class="pswp__container">
                    <div class="pswp__item"></div>
                    <div class="pswp__item"></div>
                    <div class="pswp__item"></div>
                </div>
                <div class="pswp__ui pswp__ui--hidden">
                    <div class="pswp__top-bar">
                        <div class="pswp__counter"></div>
                        <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                        <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                        <div class="pswp__preloader">
                            <div class="pswp__preloader__icn">
                                <div class="pswp__preloader__cut">
                                    <div class="pswp__preloader__donut"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="pswp__caption">
                        <div class="pswp__caption__center"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
	
         <!--################### 华丽的分割线 ###################-->
    <div>
        <div onclick="H.openWin('maijiashop', 'maijiashop.php?fid=<?=$rowm['id']?>');"   class="H-flexbox-horizontal H-padding-horizontal-both-10 H-theme-background-color-white H-touch-active" style="height:77px;">
                <img src="<?php echo $rowm['username']; ?>" width="50" height="50" style="margin-top:5px;">
 
                <p style="margin-left:5px;"><?=mb_substr($rowm['shuyu'],0,6,'utf-8')?> 
						<?php if($rows['daili']==1){ ?>
  <span class="H-icon H-display-inline-block H-padding-horizontal-both-5"><i class="H-iconfont H-icon-passuser H-vertical-middle H-font-size-14 H-theme-font-color8"></i></span>                
                        <?php } ?>
				
				
				        <?php if($rowm['typeid']==0){ ?>
                        <img src="/ui/login/img/geren.png" style="width: 16px;margin-right: 3px"  class=" H-font-size-18">
                        <?php } ?>
						<?php if($rowm['typeid']==1){ ?>
                        <img src="/ui/login/img/geti.png" style="width: 16px;margin-right: 3px"  class=" H-font-size-18">
                        <?php } ?>
						<?php if($rowm['typeid']==2){ ?>
                        <img src="/ui/login/img/qiye.png" style="width: 16px;margin-right: 3px"  class=" H-font-size-18">
                        <?php } ?>
						
						</p>
				
		      <div class="H-theme-font-color-999 H-text-show-row-1 H-margin-vertical-top-2 H-font-size-16" style="float: left;position: absolute;margin-left: 55px;font-size: 10px;margin-top: 45px;">          
                       <?=mb_substr($rowtu['content'],0,6,'utf-8')?> 
                    </div>
	
           
        </div>
		<!----------------
				<div onclick="window.location.href='?act=sc&fid=<?=$infoid?>&maijia=<?=$maijia?>'"  class="H-padding-horizontal-right-5 H-vertical-top" style="float:right;margin-top: -73px;">
                    <button class="H-outline-none H-theme-background-color-transparent H-font-size-13 H-theme-font-color1 H-theme-border-color1 H-theme-background-color1-click H-theme-font-color1-click H-border-radius-3 H-padding-horizontal-both-15 H-white-space-nowrap">收藏店铺</button>
                </div>
				
				<div onclick="H.openWin('maijiashop', 'maijiashop.php?fid=<?=$rowm['id']?>');"   class="H-padding-horizontal-right-5 H-vertical-top" style="float:right;margin-top: -37px;">
                    <button class="H-outline-none H-theme-background-color-transparent H-font-size-13 H-theme-font-color1 H-theme-border-color8 H-theme-background-color8-click H-theme-font-color8-click H-border-radius-3 H-padding-horizontal-both-15 H-white-space-nowrap">进入店铺</button>
                </div>	
				
		---------------------------->
        <div class="H-flexbox-horizontal H-text-align-center H-padding-horizontal-both-5 H-line-height-normal H-theme-font-color-black H-padding-vertical-both-15 H-box-sizing-border-box H-border-vertical-bottom-after H-theme-background-color-white">
            <div  onclick="H.openWin('maijiashop', 'maijiashop.php?fid=<?=$rowm['id']?>');" class="H-flex-item" >
                <span class="H-icon H-center-all"><?=$s?></span>
                <label class="H-display-block H-font-size-13 H-margin-vertical-top-5 H-theme-font-color-999">在售宝贝</label>
            </div>
            <div class="H-flex-item">
                <span class="H-icon H-center-all"><?=$sm?></span>
                <label class="H-display-block H-font-size-13 H-margin-vertical-top-5 H-theme-font-color-999">实名状态</label>
            </div>
            <div class="H-flex-item">
                <span class="H-icon H-center-all"><?php echo $xyf?></span>
                <label class="H-display-block H-font-size-13 H-margin-vertical-top-5 H-theme-font-color-999">信用分</label>
            </div>
        </div>
    </div>
			
                 <!--################### 华丽的分割线 ###################-->

    <div class="H-channel-title H-flexbox-horizontal H-theme-background-color-white H-vertical-middle H-border-vertical-bottom-after">
        <div class="H-channel-line H-theme-background-color7 H-padding-vertical-top-15 H-padding-horizontal-left-3  H-margin-horizontal-left-10"></div>
        <div class="H-channel-text H-theme-font-color7 H-flex-item H-font-size-18 H-theme-font-color-black H-padding-10 H-margin-horizontal-right-10 H-text-show-row-1">
            为您推荐
        </div>
    </div>

<div class="H-clear-both H-width-100-percent H-display-table H-box-sizing-border-box H-padding-horizontal-left-10 H-theme-font-color-666 H-theme-background-color-eee H-padding-vertical-top-10" 	  
       <?php if($colorr==1){ ?>
	   style="background-color:white"
       <?php } ?>	
	   <?php if($colorr==2){ ?>
	   style="background-color:#f9ebc1"
       <?php } ?>
	   <?php if($colorr==3){ ?>
	   style="background-color:#e0eef5"
       <?php } ?>>

													  	  	<?

	$sql = "SELECT * from tbl_spp where state=0 and baozjzt=1 AND userid in (SELECT id from tbl_user where viplevel=3) AND img != 'http://beta.goodshare.com.cn/wap/files/naxia.jpg' group by userid LIMIT 4";
	$_id ='t='.$_GET['t'].'&';
	$query=mysql_query($sql);
    if(!mysql_affected_rows()){
                                                                        echo '
                                                            			    <div class="H-padding-vertical-bottom-10"></div>
                                                            
                                                                <div class="H-channel-title H-flexbox-horizontal H-theme-background-color-white H-vertical-middle H-border-vertical-bottom-after">
                                                                    <div class="H-channel-line H-theme-background-color8 H-padding-vertical-top-15 H-padding-horizontal-left-3  H-margin-horizontal-left-10"></div>
                                                                    <div class="H-channel-text H-theme-font-color8 H-flex-item H-font-size-18 H-theme-font-color-black H-padding-10 H-margin-horizontal-right-10 H-text-show-row-1">暂无商品!</div>
                                                                </div>
                                                            	</br></br>
                                                            			';
    }
	while($row=mysql_fetch_array($query))
	{
	?>
	 <?php
if($row['fenlei']){
	//用于判断是租还是卖,0是租，1是卖
    $aumai="日租价";//
    $shoujia="";//售价字符
    $this1="";
    $price=$row['zujin'];
    if($row['zumai']==1){
       $aumai="售价";
       $this1="shou1";
       $price=$row['daili'];
    }else if($row['zumai']==0){
    	if($row['fangshi']==1){
        $aumai="日租价";
        $this1="zu1";
       
    	}else if($row['fangshi']==2){
    		$aumai="月租价";
        	$this1="zu1";       
    	}
    }else if($row['zumai']==2){
      if($row['fangshi']==1){
        $aumai="日租价";
        $this1="hunhe1";

      }else if($row['fangshi']==2){
        $aumai="月租价";
          $this1="hunhe1";       
      }      
    }else if($row['zumai']==3){
        $aumai="月租价";
          $this1="hunhe1";   
    }
/*$sqluy = "SELECT DISTINCT * from tbl_spp  where infoid='".$row['infoid']."' ";*/

$sql2="select * from tbl_user where id=".$row['userid'];
$query2=mysql_query($sql2);
$row2=mysql_fetch_array($query2);
$str=explode(',',$row['img']);
$a=$str[0];
if($row2['viplevel']!=0){
?>
        <div tapmode="" onclick="H.openWin('spxq', 'spxq.php?fid=<?=$row['infoid']?>');" class="H-display-table-cell H-float-left  H-box-sizing-border-box H-width-avg-2 H-padding-horizontal-right-10 H-margin-vertical-bottom-10">
            <div class="H-theme-background-color-white H-border-both H-theme-border-color-ccc H-border-radius-3 H-overflow-hidden">
                <img src=" <?=$a?>" class="H-width-100-percent H-display-block" height="160" alt="" title="">
                <div class="H-font-size-16 H-padding-vertical-top-5 H-padding-horizontal-both-8 H-text-show-row-2">
                    <span>   <?=mb_substr($row['title'],0,7,'utf-8')?></span>
                </div>
                <div class="H-flexbox-horizontal H-border-vertical-bottom-after H-padding-vertical-bottom-8 H-padding-vertical-top-3">
                    <div class="H-flex-item H-font-size-13 H-padding-horizontal-left-8"><span style="color: #FF7F00;font-size:16px">￥<?php echo $price; ?> </span><span style="font-size:10px">  原价<?=$row['daili']?></span></div>
                    <div></div>
                </div>
                <div class="H-flexbox-horizontal H-border-vertical-bottom-after H-padding-vertical-bottom-8 H-padding-vertical-top-3">
                    <div class="H-flex-item H-font-size-13 H-padding-horizontal-left-8 H-theme-font-color-999"><span>
					<?=$row['shoparea']?>
					</span>&nbsp;&nbsp;
					
								<?php if($row['zumai']==0){
                                ?>
							   租赁
							   <?php } ?>
							   
							   	<?php if($row['zumai']==1){
                                ?>
							   售卖
							   <?php } ?>
							   
							   	<?php if($row['zumai']==2){
                                ?>
							   租售混搭
							   <?php } ?>
							   	<?php if($row['zumai']==3){
                                ?>
							   以租代售
							   <?php } ?>
					
					
					</div>
                    <div></div>
                </div>
            </div>
        </div>
		
				<?}	?>	
            <?php } ?>          
		    <?php } ?>

		 
		
		

    </div>
	    <div class="H-padding-vertical-bottom-10"></div>
  </div>  
	
		
	   <!--################### 华丽的分割线 ###################-->	
   
   	</br></br>	</br></br>

	<div class="H-padding-vertical-bottom-10"></div>

       <!--################### 华丽的分割线 ###################-->

	  <!--################### 底部开始线 ###################-->	  		

		
		
	  <!--################### 底部开始线 ###################-->
<footer class="H-footer H-flexbox-horizontal H-theme-background-color-white H-border-vertical-top-after" id="footer">

        <div onclick="window.location.href='?act=sc&id=<?=$infoid?>&maijia=<?=$maijia?>'" class="H-flex-item H-center-all H-text-align-center H-theme-font-color-999 H-touch-active swipe-item">
          <button class="H-button H-font-size-12 H-outline-none H-padding-vertical-both-8 H-padding-horizontal-both-20 H-theme-background-color8 H-theme-font-color-white H-theme-border-color8 H-theme-border-color8-click H-theme-background-color8-click H-theme-font-color8-click H-border-radius-3" style="border-radius: 16px;">
		  添加收藏</button>
        </div>  &nbsp;
        <div  onclick="alert('xxx')"  class="H-flex-item H-center-all H-text-align-center H-theme-font-color-999 H-touch-active swipe-item">
           <button class="H-button H-font-size-12 H-outline-none H-padding-vertical-both-8 H-padding-horizontal-both-20 H-theme-background-color7 H-theme-font-color-white H-theme-border-color7 H-theme-border-color7-click H-theme-background-color7-click H-theme-font-color7-click H-border-radius-3"style="border-radius: 16px;">
		   联系卖家</button>
        </div> &nbsp;

    </footer>
	
	

	
	
	
	

     <!--################################底部结束################################-->   
    <script src="/ui/script/H.js" type="text/javascript"></script>
	<script type="text/javascript" src="/ui/js/jquery-1.9.1.min.js"></script>	
	<script src="/ui/plugins/photoswipe/photoswipe.min.js"></script>
    <script src="/ui/plugins/photoswipe/photoswipe-ui-default.min.js"></script>	
    <script type="text/javascript">
        var initPhotoSwipeFromDOM = function (gallerySelector) {

            // parse slide data (url, title, size ...) from DOM elements
            // (children of gallerySelector)
            var parseThumbnailElements = function (el) {
                var thumbElements = el.childNodes,
                    numNodes = thumbElements.length,
                    items = [],
                    figureEl,
                    linkEl,
                    size,
                    item;

                for (var i = 0; i < numNodes; i++) {

                    figureEl = thumbElements[i]; // <figure> element

                    // include only element nodes
                    if (figureEl.nodeType !== 1) {
                        continue;
                    }

                    linkEl = figureEl.children[0]; // <a> element

                    size = linkEl.getAttribute('data-size').split('x');

                    // create slide object
                    item = {
                        src: linkEl.getAttribute('href'),
                        w: parseInt(size[0], 10),
                        h: parseInt(size[1], 10)
                    };



                    if (figureEl.children.length > 1) {
                        // <figcaption> content
                        item.title = figureEl.children[1].innerHTML;
                    }

                    if (linkEl.children.length > 0) {
                        // <img> thumbnail element, retrieving thumbnail url
                        item.msrc = linkEl.children[0].getAttribute('src');
                    }

                    item.el = figureEl; // save link to element for getThumbBoundsFn
                    items.push(item);
                }

                return items;
            };

            // find nearest parent element
            var closest = function closest(el, fn) {
                return el && (fn(el) ? el : closest(el.parentNode, fn));
            };

            // triggers when user clicks on thumbnail
            var onThumbnailsClick = function (e) {
                e = e || window.event;
                e.preventDefault ? e.preventDefault() : e.returnValue = false;

                var eTarget = e.target || e.srcElement;

                // find root element of slide
                var clickedListItem = closest(eTarget, function (el) {
                    return (el.tagName && el.tagName.toUpperCase() === 'FIGURE');
                });

                if (!clickedListItem) {
                    return;
                }

                // find index of clicked item by looping through all child nodes
                // alternatively, you may define index via data- attribute
                var clickedGallery = clickedListItem.parentNode,
                    childNodes = clickedListItem.parentNode.childNodes,
                    numChildNodes = childNodes.length,
                    nodeIndex = 0,
                    index;

                for (var i = 0; i < numChildNodes; i++) {
                    if (childNodes[i].nodeType !== 1) {
                        continue;
                    }

                    if (childNodes[i] === clickedListItem) {
                        index = nodeIndex;
                        break;
                    }
                    nodeIndex++;
                }



                if (index >= 0) {
                    // open PhotoSwipe if valid index found
                    openPhotoSwipe(index, clickedGallery);
                }
                return false;
            };

            // parse picture index and gallery index from URL (#&pid=1&gid=2)
            var photoswipeParseHash = function () {
                var hash = window.location.hash.substring(1),
                params = {};

                if (hash.length < 5) {
                    return params;
                }

                var vars = hash.split('&');
                for (var i = 0; i < vars.length; i++) {
                    if (!vars[i]) {
                        continue;
                    }
                    var pair = vars[i].split('=');
                    if (pair.length < 2) {
                        continue;
                    }
                    params[pair[0]] = pair[1];
                }

                if (params.gid) {
                    params.gid = parseInt(params.gid, 10);
                }

                return params;
            };

            var openPhotoSwipe = function (index, galleryElement, disableAnimation, fromURL) {
                var pswpElement = document.querySelectorAll('.pswp')[0],
                    gallery,
                    options,
                    items;

                items = parseThumbnailElements(galleryElement);

                // define options (if needed)
                options = {

                    // define gallery index (for URL)
                    galleryUID: galleryElement.getAttribute('data-pswp-uid'),

                    getThumbBoundsFn: function (index) {
                        // See Options -> getThumbBoundsFn section of documentation for more info
                        var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
                            pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
                            rect = thumbnail.getBoundingClientRect();

                        return { x: rect.left, y: rect.top + pageYScroll, w: rect.width };
                    }

                };

                // PhotoSwipe opened from URL
                if (fromURL) {
                    if (options.galleryPIDs) {
                        // parse real index when custom PIDs are used
                        // http://photoswipe.com/documentation/faq.html#custom-pid-in-url
                        for (var j = 0; j < items.length; j++) {
                            if (items[j].pid == index) {
                                options.index = j;
                                break;
                            }
                        }
                    } else {
                        // in URL indexes start from 1
                        options.index = parseInt(index, 10) - 1;
                    }
                } else {
                    options.index = parseInt(index, 10);
                }

                // exit if index not found
                if (isNaN(options.index)) {
                    return;
                }

                if (disableAnimation) {
                    options.showAnimationDuration = 0;
                }

                // Pass data to PhotoSwipe and initialize it
                gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
                gallery.init();
            };

            // loop through all gallery elements and bind events
            var galleryElements = document.querySelectorAll(gallerySelector);

            for (var i = 0, l = galleryElements.length; i < l; i++) {
                galleryElements[i].setAttribute('data-pswp-uid', i + 1);
                galleryElements[i].onclick = onThumbnailsClick;
            }

            // Parse URL and open gallery if it contains #&pid=3&gid=1
            var hashData = photoswipeParseHash();
            if (hashData.pid && hashData.gid) {
                openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
            }
        };

        // execute above function
        initPhotoSwipeFromDOM('.my-gallery');
    </script>
	
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
    document.write("<script src='accessToken/signPackage.php?originUrl=" + window.location.href + "' type='text/javascript'><\/script>");
</script>
<script>
    var baseUrl = window.location.href;
    var img = '<?php echo $imgeve[0]?>';	
    var title = '<?php echo $shopname?>';
    var desc = '<?php echo $maijianame?>';	
    var wxData = {
        "imgUrl" : img,
        "link"   : baseUrl,
        "title"  : title,
        "desc"   : desc
    };
    wx.config({
        debug: false,
        appId: signPackage.appId,
        timestamp: parseInt(signPackage.timestamp),
        nonceStr: signPackage.nonceStr,
        signature: signPackage.signature,
        jsApiList: [
            'onMenuShareTimeline',
            'onMenuShareAppMessage'
        ]
    });
    wx.ready(function () {
        wx.onMenuShareTimeline({
            title: wxData.title,
            link: wxData.link,
            imgUrl: wxData.imgUrl,
            success: function () {
            }
        });
        wx.onMenuShareAppMessage({
            title: wxData.title,
            desc: wxData.desc,
            link: wxData.link,
            imgUrl: wxData.imgUrl,
            type: 'link',
            dataUrl: '',
            success: function () {
            }
        });
    });
</script>
</body>
</html>